include .env
ARTIFACT_DIR?=strimzi-0.40.0
NAMESPACE?=bi-service
CLUSTER_NAME?=bi-kafka
USER_NAME?=xuwenjie
export

deploy:
	kubectl apply -f ./kafka-kraft.yaml -n ${NAMESPACE}

deploy_dev:
	kubectl apply -f ./kafka-kraft_dev.yaml -n ${NAMESPACE}

uninstall:
	kubectl delete -f ./kafka-kraft.yaml -n ${NAMESPACE}

uninstall_dev:
	kubectl delete -f ./kafka-kraft_dev.yaml -n ${NAMESPACE}

extract_key:
	kubectl get secret ${CLUSTER_NAME}-cluster-ca-cert -o jsonpath='{.data.ca\.crt}' | base64 -d > users/ca.crt
	kubectl get secret ${USER_NAME} -o jsonpath='{.data.user\.crt}' | base64 -d > users/${USER_NAME}/user.crt
	kubectl get secret ${USER_NAME} -o jsonpath='{.data.user\.key}' | base64 -d > users/${USER_NAME}/user.key